<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <script src="${pageContext.request.contextPath}/static/js/jquery-3.5.1.min.js"></script>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/static/css/header.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap.min.css"/>
    <script src="${pageContext.request.contextPath}/static/bootstrap/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/vue/vue.min.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css" media="all">
    <script src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
    <title>管理员管理</title>
</head>
<style>
    iframe {
        position: relative;
        float: left;
        display: block;
    }
</style>
<%--<script>--%>
<%--    $(function () {--%>
<%--        vm.getName();--%>
<%--    })--%>
<%--</script>--%>
<%-- onload="getName()"--%>
<body>
<div class="container-fluid" id="all">
    <div class="row">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
            <legend>管理员管理菜单</legend>

        </fieldset>

        <div class="btn btn-danger" style="float: right" @click="tohome">退出登录</div>
        <div style="float:right;margin: 10px 10px;">管理员 {{controllerName}} 欢迎你！</div>
    </div>
    <div class="col-md-3" style="width: 230px; padding: 0px;margin-top: 30px;">

        <ul class="layui-nav layui-nav-tree layui-inline" lay-filter="demo" style="margin-right: 10px;">
            <li class="layui-nav-item layui-nav-itemed"><a href="javascript:;">展开管理</a>
                <dl class="layui-nav-child">
                    <dd>
                        <%--      userMessage UpdateAdminMessage             --%>
                        <a href="#" @click="change('/admin/toupdate?action=2')">管理员信息</a>
                    </dd>
                    <dd>
                        <%--       adminBookList            --%>
                        <a href="#" @click="change('/admin/admingetBooks')">查看书籍</a>
                    </dd>
                    <dd>
                        <%--      addBook              --%>
                        <a href="#" @click="change('/admin/toaddBook')">添加书籍</a>
                    </dd>
                    <dd>
                        <%--      AllLender              --%>
                        <a href="#" @click="change('/admin/getAllLender')">查看借阅</a>
                    </dd>
                    <dd>
                        <a href="#" @click="change('/admin/touser')">用户信息</a>
                    </dd>
                    <dd>
                        <%--      UpdateUserMessage              --%>
                        <a href="#" @click="change('/admin/toupdate?action=1')">修改我的信息</a>
                    </dd>
                </dl>
            </li>
        </ul>
    </div>
    <div class="col-md-8">
        <iframe id="myframe" :src="isrc" frameborder="0" height="600px" width="1000px"></iframe>
    </div>
</div>
<%--<p><a href="${pageContext.request.contextPath}/admin/admingetBooks">查看书籍</a></p>--%>
<%--<p><a href="${pageContext.request.contextPath}/admin/toaddBook">添加书籍</a></p>--%>
<%--<p><a href="${pageContext.request.contextPath}/admin/getAllLender">查看借阅</a></p>--%>
<%--<p><a href="${pageContext.request.contextPath}/admin/toupdate">管理员信息</a></p>--%>
<%--<p><a href="${pageContext.request.contextPath}/index.jsp">退出登录</a></p>--%>
</body>
<script src="${pageContext.request.contextPath}/static/axios/axios.js"></script>
<script>
    let vm = new Vue({
            el: '#all',
            data: {
                // action: 2,
                controllerName: "controllerName",
                isrc: "${pageContext.request.contextPath}/hello.html",
            },
            mounted() {
                // getName: function () {
                axios.get("${pageContext.request.contextPath}/getName?action=2")
                    .then(resp => this.controllerName = resp.data)
                    .catch(function (error) {
                            alert("管理员名错误" + this.controllerName)
                        }
                    )
            },
            methods: {
                change: function (data) {
                    this.isrc = "${pageContext.request.contextPath}" + data;
                }
                ,
                tohome: function () {
                    window.location = "${pageContext.request.contextPath}/index.jsp";
                }
                ,
            }
        })
    ;
</script>
</html>
